﻿using FluentFTP;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
using static System.Net.WebRequestMethods;

namespace LD.Host
{
    public static class FtpHelper
    {
        private static FtpClient client;
        private static bool isOpen;
        public static void Connection(string ip, string account, string pwd)
        {
            try
            {
                //ftp
                client = new FtpClient(ip);
                client.Port = 21;
                client.Credentials = new NetworkCredential(account, pwd);
                client.Connect();
                isOpen = true;
            }
            catch (Exception ex)
            {
                isOpen = false;
                Log4.Error("FPT:" + ex);
            }
        }
        public static bool IsOpen
        {
            get { return isOpen; }
            private set { isOpen = value; }
        }
        public static FtpClient Client
        {
            get { return client; }
        }
    }
}
